package com.xjgc.eip.panel.controller;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xjgc.common.entity.ReturnResult;
import com.xjgc.common.utils.TransNoUitl;
import com.xjgc.eip.panel.entity.ZxjEipCpxx;
import com.xjgc.eip.panel.service.ZxjEipCpxxService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wxy
 * @since 2019-11-08
 */
@RestController
@RequestMapping("/zxjEipCpxx")
public class ZxjEipCpxxController {
    @Autowired
    private ZxjEipCpxxService zxjEipCpxxService;

    @RequestMapping("productInfo")
    public ReturnResult productInfo(){
        ZxjEipCpxx zxjEipCpxx = new ZxjEipCpxx();
        zxjEipCpxx.setIoflag("0");
        QueryWrapper<ZxjEipCpxx> queryWrapper =new QueryWrapper<>();
        queryWrapper.setEntity(zxjEipCpxx);
        List<ZxjEipCpxx> list = zxjEipCpxxService.list(queryWrapper);
        ReturnResult returnResult = new ReturnResult();
        returnResult.setData(list);
        String orisys="0";
        String transno="";
        String operatetype="add";
        for (ZxjEipCpxx zes:list) {
            //header数据
            if ("0".equals(zes.getStatus())){//新增
                transno= TransNoUitl.genTransNo();
            }else if ("1".equals(zes.getStatus())){//更新
                transno= TransNoUitl.genTransNo();
                operatetype="update";
            }
            //body数据  就是zex
            //TODO   调用接口推送数据
            //TODO   根据返回状态  status 修改推送结果
        }
        return returnResult;
    }


}

